package org.ithasu.helpers;

import org.ithasu.tools.ObjectTools;

public class Pair<K, V> {

	public final K key;
	public final V value;

	public Pair(K key, V value) {
		this.key = key;
		this.value = value;
	}

	@Override
	public String toString() {
		return "<" + String.valueOf(key) + ", " + String.valueOf(value) + ">";
	}

	@SuppressWarnings("rawtypes")
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Pair) {
			return ObjectTools.equalsOrBothNull(key, ((Pair) obj).key)
					&& ObjectTools.equalsOrBothNull(value, ((Pair) obj).value);
		}
		return super.equals(obj);
	}
}
